<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>商家入驻申请</title>
    <script>
        function submitForm() {
            // 获取表单数据
            var name = document.getElementById("name").value;
            var password = document.getElementById("password").value;
            var contact = document.getElementById("contact").value;
            var phone = document.getElementById("phone").value;
            var email = document.getElementById("email").value;
            var address = document.getElementById("address").value;
            var type = document.querySelector('input[name="type"]:checked').value;
            var realname = document.getElementById("realname").value;
            var idnumber = document.getElementById("idnumber").value;
            var file = "";
            $.ajax({
                type: "POST",
                url: "merchant/update",
                data: JSON.stringify({
                    mname: name,
                    mpassword: password,
                    mcontact: contact,
                    mphone: phone,
                    memail: email,
                    maddress: address,
                    merchantType: type,
                    mrealName: realname,
                    midCard: idnumber,
                    midCardImg: file
                }),
                dataType: 'JSON',
                contentType: 'text',
                success: function (data) {
                    if (data.code == 200) {
                        alert("商家入驻申请成功，请等待管理员审核");

                    } else {
                        alert("商家入驻申请失败，请检查信息是否填写正确");
                    }
                },

})

        }
    </script>
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f9f9f9;
            padding: 20px;
        }
        .container {
            max-width: 600px;
            margin: auto;
            background: white;
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        }
        h2 {
            text-align: center;
        }
        .form-group {
            margin-bottom: 15px;
        }
        label {
            display: block;
            margin-bottom: 5px;
        }
        input[type="text"],
        input[type="password"],
        input[type="email"],
        input[type="file"] {
            width: 100%;
            padding: 8px;
            border: 1px solid #ccc;
            border-radius: 4px;
        }
        input[type="radio"] {
            margin-right: 5px;
        }
        button {
            width: 100%;
            padding: 10px;
            background-color: #28a745;
            color: white;
            border: none;
            border-radius: 4px;
            cursor: pointer;
        }
        button:hover {
            background-color: #218838;
        }
    </style>
</head>
<body>

<div class="container">
    <h2>商家入驻申请</h2>
    <form>
        <div class="form-group">
            <label for="name">商家名称</label>
            <input type="text" id="name" placeholder="请输入商家名称" required>
        </div>
        <div class="form-group">
            <label for="password">商家密码</label>
            <input type="password" id="password" placeholder="请输入商家密码" required>
        </div>
        <div class="form-group">
            <label for="contact">商家联系人</label>
            <input type="text" id="contact" placeholder="请输入商家联系人" required>
        </div>
        <div class="form-group">
            <label for="phone">商家联系人电话</label>
            <input type="text" id="phone" placeholder="请输入商家联系人电话" required>
        </div>
        <div class="form-group">
            <label for="email">商家邮箱</label>
            <input type="email" id="email" placeholder="请输入商家邮箱,用于激活账号" required>
        </div>
        <div class="form-group">
            <label for="address">商家地址</label>
            <input type="text" id="address" placeholder="请输入商家地址" required>
        </div>
        <div class="form-group">
            <label>商家类型</label>
            <label><input type="radio" name="type" value="个人" required> 个人</label>
            <label><input type="radio" name="type" value="企业" required> 企业</label>
        </div>
        <div class="form-group">
            <label for="realname">商家真实名称</label>
            <input type="text" id="realname" placeholder="请输入商家真实名称" required>
        </div>
        <div class="form-group">
            <label for="idnumber">商家证件号</label>
            <input type="text" id="idnumber" placeholder="请输入商家证件号" required>
        </div>
        <div class="form-group">
            <label for="file">商家证件未选择文件</label>
            <input type="file" id="file" required>
        </div>
        <button type="submit" onclick="submitForm()">提交申请</button>
    </form>
</div>

</body>
</html>
